package game.gui;

import engine.Engine;
import engine.game.Manager;
import engine.graphics.Color4f;
import engine.graphics.FontManager;
import engine.gui.Label;
import engine.gui.Panel;
import engine.system.MADFrameRate;
import game.objects.nonstaticObjects.EntityModel;

public class InfoBar extends Panel {

	private static final long serialVersionUID = 1L;

	private final EntityModel entity ; 
	private Label playerPos = null ; 
	
	public InfoBar(Manager m, EntityModel entity) {
		super(m, 0, Engine.HEIGHT-100, Engine.WIDTH, 100);
		this.entity = entity ; 
		init(); 
	}
	
	public void init(){
		super.init(); 
		this.changeNormalColor(new Color4f(0.15f, 0.15f, 0.15f, 0.15f));
		playerPos = new Label(this.getManager(), this, ""); 
		playerPos.padding(10, -15);
		playerPos.setFontName(FontManager.S_FONT_11); 
		this.addNewChild("playerPos", playerPos); 
	}
	
	public void update(){
		String line1 = "MADEntertainment presents: Jump'n'Run"; 
		line1 += "\n(C) 2013 by Markus \"MADinow\" Danilow" ; 
		line1 += "\nFPS: "+MADFrameRate.getFPS(); 
		line1 += "\nSpieler - Position: ( "+entity.getPosition().getX()+" | "+
		entity.getPosition().getY()+" )";
		playerPos.setCaption(line1);
		super.update(); 
	}

}
